package org.webguitoolkit.project.model.impl;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.webguitoolkit.project.model.IAttachment;
import org.webguitoolkit.project.model.IIssue;

import com.endress.infoserve.persistence.model.Persistable;

/**
 * sample model object with name
 */
@Entity
@Table(name = "PM_OBJECT")
public class Issue extends Persistable implements IIssue {

	public static final String ATTRIBUTE_NAME = "name";

	@Column(name = "issueID", length = 64)
	private String issueID;

	@Column(name = "description", length = 254)
	private String description;

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	private Set<IAttachment> attachments;

	/**
	 * constructor used by hibernate
	 */
	protected Issue() {
	}

	public Issue(String issueID) {
		this.issueID = issueID;
	}

	public String getIssueID() {
		return issueID;
	}

	public void addAttachment(IAttachment attachment) {
		attachments.add(attachment);
	}

	public Set<IAttachment> getAttachments() {
		return attachments;
	}

	public void removeAttachment(IAttachment attachment) {
		attachments.remove(attachment);
	}

}
